package com.xinqi.common.green.annotation;

import com.xinqi.common.green.validator.TextValidator;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.Documented;
import java.lang.annotation.Repeatable;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
 * @version V1.0
 * @Title: 文字智能检测
 * @ClassName: com.xinqi.common.base.green.annotation.Image.java
 * @Description: 使用与javax.validation 校验一致
 * @Copyright 星齐科技（云南）有限公司 - Powered By 技术部
 * @author: yyzhen
 * @date: 2023/4/19 16:40
 */
@Documented
@Target({PARAMETER, FIELD})
@Retention(RUNTIME)
@Repeatable(Text.List.class)
@Constraint(validatedBy = {TextValidator.class})
public @interface Text {

    String message() default "{green.submit.text.message}";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};

    @Target({FIELD, PARAMETER})
    @Retention(RUNTIME)
    @Documented
    public @interface List {
        Text[] value();
    }

}
